Bayesian Inference
Bayesian inference is a statistical approach to making predictions or inferences about unknown parameters in a given model. This approach is named after the 18th-century mathematician and statistician Thomas Bayes.
Bayesian vs Frequentist Inference
The Bayesian approach is in contrast to the frequentist approach to statistical inference. Frequentist inference only considers the probability of observed data given a model, whereas Bayesian inference considers both the probability of the observed data given the model and the prior probability of the model parameters.
In frequentist inference, the parameter is considered fixed, and the probability distribution of the observed data is calculated under that assumption. In contrast, Bayesian inference treats the parameter as a random variable with a prior distribution, and updates the distribution of the parameter based on the observed data.
Bayes' Theorem
Bayes' theorem is the foundation of Bayesian inference. It states that the posterior probability of a hypothesis is proportional to the prior probability of the hypothesis, multiplied by the likelihood of the data given the hypothesis.
P(θ∣x)=P(x)P(x∣θ)P(θ)
where:
- P(θ∣x) is the posterior probability of the parameter θ given the data x
- P(x∣θ) is the likelihood of the data x given the parameter θ
- P(θ) is the prior probability of the parameter θ
- P(x) is the marginal probability of the data x
Bayesian inference involves updating the prior probability distribution of the parameter based on the observed data using Bayes' theorem.
Example
Suppose we want to determine the probability of a fair coin landing heads up. We can model the outcome of a coin flip with a Bernoulli distribution, where x=1 represents heads and x=0 represents tails. The probability of the coin flipping heads is denoted as θ, and we assume a prior distribution of θ∼Beta(a,b).
Let's say we flip the coin 10 times and observe 6 heads and 4 tails. We can update the prior distribution of θ using Bayes' theorem:
P(θ∣x)=P(x)P(x∣θ)P(θ)=∫01θ6(1−θ)4Γ(a)Γ(b)Γ(a+b)θa−1(1−θ)b−1dθθ6(1−θ)4Γ(a)Γ(b)Γ(a+b)θa−1(1−θ)b−1=∫01θa+6−1(1−θ)b+4−1Γ(a+6)Γ(b+4)Γ(a+b)dθθa+6−1(1−θ)b+4−1Γ(a+6)Γ(b+4)Γ(a+b)
The posterior distribution of θ is a Beta distribution with parameters a+6 and b+4. We can use this posterior distribution to make predictions about the probability of the coin landing heads up.
Conclusion
Bayesian inference offers a powerful framework for making predictions and inferences about model parameters. It allows for the incorporation of prior knowledge and the updating of that knowledge based on observed data. By using Bayes' theorem, we can calculate the posterior distribution of parameters and make probability predictions about future events.